﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ListenMusic.Musician_ServiceReference;
using System.ServiceModel;
namespace ListenMusic.Models.Reposistory.Public
{
    public class MusicianReposistory
    {
        MusicianServiceClient clientMusician;
        public MusicianReposistory()
        {
            clientMusician = new MusicianServiceClient();
        }
        public List<Musician> getAllMusician()
        {
            try {
                Musician[] musician = clientMusician.getAllMusician();
                return musician.ToList();
            }
            catch (FaultException e) { throw e; }
        }
        public int getMaxID_Musician()
        {
            try
            {
                return clientMusician.getMaxID_Musician();
            }
            catch (FaultException e) { throw e; }
        }
        public Musician checkMusicianName(string musicianname)
        {
            try
            {
                Musician s = clientMusician.checkMusicianName(musicianname);
                return s;
            }
            catch (FaultException e) { throw e; }
        }
        public bool insertNewMusician(Musician musician)
        {
            try
            {
                return clientMusician.insertNewMusician(musician);
            }
            catch (FaultException e) { throw e; }
        }
        public Musician getMusician_byID(int musicianID)
        {
            try
            {
                Musician m = clientMusician.getMusician_byID(musicianID);
                return m;
            }
            catch (FaultException e) { throw e; }
        }
    }
}